package com.ruoyi.system.domain;

import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import java.io.Serial;

/**
 * 通知公告表 sys_notice
 *
 * @author ruoyi
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@DynamicUpdate
@DynamicInsert
public class SysNotice extends BaseEntity {
	@Serial
	private static final long serialVersionUID = 1L;

	/** 公告ID */
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "sys_notice_seq")
	@SequenceGenerator(name = "sys_notice_seq", initialValue = 1000)
	private Long noticeId;

	/** 公告标题 */
	@Xss(message = "公告标题不能包含脚本字符")
	@NotBlank(message = "公告标题不能为空")
	@Size(max = 50, message = "公告标题不能超过50个字符")
	private String noticeTitle;

	/** 公告类型（1:通知 2:公告） */
	private String noticeType;

	/** 公告内容 */
	private String noticeContent;

	/** 公告状态（0正常 1关闭） */
	private String status;

	@Override
	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
				.append("noticeId", getNoticeId())
				.append("noticeTitle", getNoticeTitle())
				.append("noticeType", getNoticeType())
				.append("noticeContent", getNoticeContent())
				.append("status", getStatus())
				.append("createBy", getCreateBy())
				.append("createTime", getCreateTime())
				.append("updateBy", getUpdateBy())
				.append("updateTime", getUpdateTime())
				.append("remark", getRemark())
				.toString();
	}
}
